﻿Public Class frmVacaciones
    Dim vaca As New clsVacaciones
    Dim Bitacora As New clsActividad
    Private Sub frmVacaciones_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ToolStrip2.Cursor = Cursors.Hand
        ToolStrip2.RenderMode = System.Windows.Forms.ToolStripRenderMode.System
        ToolStrip2.Stretch = True

        Me.txtID.Text = (BuscarIntDatoCitra("SELECT MAX(IDVacacion) as Id FROM Vacaciones")) + 1
        Me.txtIDEmpleado.Text = EmpleadoID
        Me.txtNombre.Text = frmModuloEmpleadosDetalle.txtPaterno.Text.Trim & " " & frmModuloEmpleadosDetalle.txtMaterno.Text.Trim & " " & frmModuloEmpleadosDetalle.txtNombre.Text.Trim

        Me.datFecha1.Value = Now()
        Me.datFecha2.Value = Now()
        Me.datPeriodo1.Value = Now()
        Me.datPeriodo2.Value = Now()

        Me.lstPeriodo.Items.Clear()
        Me.lstPeriodo.Items.Add("Periodo Actual")
        Me.lstPeriodo.Items.Add("Periodo Atrasado")

        Me.txtObservaciones.Clear()

    End Sub
    Sub gather()
        vaca.idVacacion = Me.txtID.Text
        vaca.idempleado = Me.txtIDEmpleado.Text
        vaca.TomaFechainicial = Me.datFecha1.Value
        vaca.TomaFechafinal = Me.datFecha2.Value
        vaca.esFechainicial = Me.datPeriodo1.Value
        vaca.esFechafinal = Me.datPeriodo2.Value
        vaca.Periodo = Me.lstPeriodo.Text
        vaca.Observaciones = Me.txtObservaciones.Text.Trim
        vaca.Capturo = usuarioactivo
        vaca.Reportado = "No"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub toolGuardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub toolSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub

    Private Sub ToolStripButton5_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButton5.Click
        If Me.lstPeriodo.Text = "" Then
            MsgBox("Debes indicar el periodo", MsgBoxStyle.Exclamation, "Aviso")
            Exit Sub
        End If
        gather()
        vaca.Insertar()
        frmModuloEmpleadosDetalle.cargaVacaciones()
        Bitacora.RegistraActividad("Registró vacaciones de " & txtNombre.Text.Trim & " a las ")
        Me.Close()
    End Sub

    Private Sub ToolStripButton1_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButton1.Click
        Close()

    End Sub
End Class